﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using BLL;
using DAL;
using Models;
using System.Text;
using System.Data;
using System.Xml;

public partial class cn_help_center_help_list : System.Web.UI.Page
{
    // Fields
    protected ArticleManager am = new ArticleManager();
    protected ArticleTypeManager atm = new ArticleTypeManager();
    protected string basicSetXmlPath = "/cn/xml/website_set.xml";


    // Methods
    protected StringBuilder HelpListBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            builder.AppendLine("<dl>");
            string parentId = this.atm.GetArticleTypeByTypeNameAndParentIdAndLanguageVersion("帮助中心", "00000000-0000-0000-0000-000000000000", "zh-CN");
            DataTable articleTypeByParentTypeAndLanguageVersion = this.atm.GetArticleTypeByParentTypeAndLanguageVersion(parentId, "zh-CN");
            foreach (DataRow row in articleTypeByParentTypeAndLanguageVersion.Rows)
            {
                builder.AppendLine("<h4>" + row["typeName"] + "</h4>");
                DataTable atricleByArticleTypeIdAndTop = this.am.GetAtricleByArticleTypeIdAndTop(row["id"].ToString(), 0);
                builder.AppendLine("<p>");
                foreach (DataRow row2 in atricleByArticleTypeIdAndTop.Rows)
                {
                    builder.AppendLine(string.Concat(new object[] { "<a href=\"help_detail.html?id=", row2["id"], "\">", row2["articleTilte"], "</a>" }));
                }
                builder.AppendLine("</p>");
            }
            builder.AppendLine("</dl>");
        }
        catch
        {
        }
        return builder;
    }

    protected StringBuilder HelpTypeBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            builder.AppendLine("<dl>");
            string parentId = this.atm.GetArticleTypeByTypeNameAndParentIdAndLanguageVersion("帮助中心", "00000000-0000-0000-0000-000000000000", "zh-CN");
            DataTable articleTypeByParentTypeAndLanguageVersion = this.atm.GetArticleTypeByParentTypeAndLanguageVersion(parentId, "zh-CN");
            foreach (DataRow row in articleTypeByParentTypeAndLanguageVersion.Rows)
            {
                builder.AppendLine("<dt><strong>" + row["typeName"] + "</strong></dt>");
                DataTable atricleByArticleTypeIdAndTop = this.am.GetAtricleByArticleTypeIdAndTop(row["id"].ToString(), 0);
                foreach (DataRow row2 in atricleByArticleTypeIdAndTop.Rows)
                {
                    builder.AppendLine(string.Concat(new object[] { "<dd><a href=\"help_detail.html?id=", row2["id"], "\">", row2["articleTilte"], "</a></dd>" }));
                }
            }
            builder.AppendLine("</dl>");
        }
        catch
        {
        }
        return builder;
    }

    protected StringBuilder InfoBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            XmlDocument document = new XmlDocument();
            document.Load(base.Server.MapPath(this.basicSetXmlPath));
            builder.AppendLine("<dt>联系我们</dt>");
            XmlElement element = (XmlElement)document.SelectSingleNode("set/telephone");
            builder.AppendLine("<dd>免费热线：<strong>" + element.GetAttribute("value") + "</strong></dd>");
            XmlElement element2 = (XmlElement)document.SelectSingleNode("set/enterprise_email");
            builder.AppendLine("<dd>Email：" + element2.GetAttribute("value") + "</dd>");
        }
        catch
        {
        }
        return builder;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
    }

}